<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix='security'
	uri='http://www.springframework.org/security/tags'%>


<html>

	<c:forEach items="${personList}" var="oneperson">
		<div>
			${oneperson.firstName} pass=${oneperson.passwordHash}
			<c:forEach items="${oneperson.roles}" var="role">${role} </c:forEach>
		</div>
	</c:forEach>

	<security:authorize ifAnyGranted="ROLE_ADMIN,ROLE_USER">
		<form:form commandName="person">
			<table>
				<tr>
					<td>
						<spring:message code="firstName" />
					</td>
					<td>
						<form:errors path="firstName" />
						<br>
						<form:input path="firstName" />
					</td>
				</tr>
				<tr>
					<td>
						<spring:message code="lastName" />
					</td>
					<td>
						<form:errors path="lastName" />
						<br>
						<form:input path="lastName" />
					</td>
				</tr>
				<tr>
					<td>
						<spring:message code="login" />
					</td>
					<td>
						<form:errors path="login" />
						<br>
						<form:input path="login" />
					</td>
				</tr>
				<tr>
					<td>
						<spring:message code="password" />
					</td>
					<td>
						<form:errors path="passwordHash" />
						<br>
						<form:input path="passwordHash" />
					</td>
				</tr>
				<tr>
					<td>
						<spring:message code="email" />
					</td>
					<td>
						<form:errors path="email" />
						<br>
						<form:input path="email" />
					</td>
				</tr>
				<tr>
					<td>
						<spring:message code="status" />
					</td>
					<td>
						<form:select path="active">
							<form:option value="false" label="not active" />
							<form:option value="true" label="active" />
						</form:select>
					</td>
				</tr>
				<tr>
					<td colspan="3">
						<input name="control" type="submit" value="OK" />
						<input name="control" type="submit" value="Cancel" />
					</td>
				</tr>
			</table>
			<input name="id" type="hidden" value="${command.id}" />
		</form:form>
	</security:authorize>

</html>